<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://xmlns.jcp.org/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>Event's details</title>
	<style>
.panel {
	width: 600px;
}
</style>
</h:head>

<h:body>

	<h:form>
		<p:growl id="msgs" showDetail="true" />
		<p:panel class="panel" header="event details">
			<h:panelGrid columns="2" cellpadding="5" id="eventDetailsGrid">
				<h:outputLabel for="title" value="Title:" />
				<h:outputText id="title" value="#{scheduleView.calendarEvent.title}"
					required="true" disabled="#{scheduleView.notCreator}" />

				<h:outputLabel value="Creator:" />
				<h:outputText
					value="#{scheduleView.calendarEvent.organizerUser.username}" />

				<h:outputLabel for="from" value="From:" />
				<h:outputText value="#{scheduleView.calendarEvent.startDate}">
					<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm"
						timeZone="GMT+1" />
				</h:outputText>

				<h:outputLabel for="to" value="To:" />
				<h:outputText value="#{scheduleView.calendarEvent.endDate}">
					<f:convertDateTime type="date" pattern="dd/MM/yyyy HH:mm"
						timeZone="GMT+1" />
				</h:outputText>


				<h:outputLabel value="Description:" />
				<h:outputText value="#{scheduleView.calendarEvent.description}" />

				<h:outputLabel value="Location:" />
				<h:outputText value="#{scheduleView.calendarEvent.location}" />

				<h:outputLabel value="type:" />
				<h:outputText value="indoor" />
				<h:outputLabel value="visibility:" />
				<h:outputText value="#{scheduleView.calendarEvent.visibility}" />



				<h:outputLabel value="invited users:" />
				<p:dataScroller value="#{scheduleView.getNotifications()}"
					var="user" chunkSize="10">
					<h:panelGrid columns="1" style="width:100%">
						<h:outputText value="#{user.username}" />
					</h:panelGrid>
				</p:dataScroller>

				<h:outputLabel value="participating users:" />
				<p:dataScroller value="#{scheduleView.getInvitations()}" var="user"
					chunkSize="10">
					<h:outputText value="#{user.username}" />
				</p:dataScroller>
				<p:commandButton value="Update Event"
					disabled="#{scheduleView.notCreator}" update="eventUpdate"
					oncomplete="PF('eventDialog').show();" />
				<p:commandButton value="Main Page" icon="ui-icon-home"
					action="mainPage" immediate="true" />
			</h:panelGrid>

			<!-- popup that allows the user to modify the event -->
			<p:dialog widgetVar="eventDialog" header="Update Event"
				showEffect="clip" hideEffect="clip">
				<!-- grid in which there are event's details -->
				<h:panelGrid id="eventUpdate" columns="2">
					<h:outputLabel for="title2" value="Title:" />
					<h:inputText id="title2"
						value="#{scheduleView.calendarEvent.title}" required="true"
						disabled="#{scheduleView.notCreator}" />


					<h:outputLabel for="from" value="From:" />
					<p:calendar value="#{scheduleView.calendarEvent.startDate}"
						mode="popup" disabled="#{scheduleView.notCreator}"
						pattern="dd/MM/yyyy HH:mm">
					</p:calendar>

					<h:outputLabel for="to" value="To:" />
					<p:calendar value="#{scheduleView.calendarEvent.endDate}"
						mode="popup" disabled="#{scheduleView.notCreator}"
						pattern="dd/MM/yyyy HH:mm">
					</p:calendar>


					<h:outputLabel value="Description:" />
					<h:inputText value="#{scheduleView.calendarEvent.description}"
						disabled="#{scheduleView.notCreator}" />

					<h:outputLabel value="Location:" />
					<h:inputText value="#{scheduleView.calendarEvent.location}"
						disabled="#{scheduleView.notCreator}" />

					<h:outputLabel value="type:" />
					<h:outputText value="indoor" />
					<h:outputLabel value="visibility:" />
					<p:selectOneMenu id="visible2"
						value="#{scheduleView.calendarEvent.visibility}"
						style="width:125px">
						<f:selectItem itemLabel="Public" itemValue="public" />
						<f:selectItem itemLabel="Private" itemValue="private" />
					</p:selectOneMenu>
					<p:commandButton id="deleteButton" value="Delete"
						action="#{scheduleView.deleteEvent()}" update="msgs" />
					<p:commandButton value="Update"
						action="#{scheduleView.updateEvent()}" update="msgs" />
				</h:panelGrid>
			</p:dialog>

		</p:panel>
	</h:form>
</h:body>
</html>